﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Twin
{
    class OP
    {
        // File name
        public const byte _CFG  =   0;       
        public const byte _MDL  =   1;       

        
        //=============================== 消息码 ========================================
        public const byte MSG_REAL  =   0x60;
        public const byte MSG_AREA  =   0x61;

        //=============================== 操作码 ========================================
        public const byte OP_WR_AREA   =   0x10;
        public const byte WR_CFG    =   (0x10|_CFG);
        public const byte WR_MDL    =   (0x10|_MDL);


        public const byte OP_RD_AREA   =   0x20;
        public const byte RD_CFG    =   (0x20|_CFG);
        public const byte RD_MDL    =   (0x20|_MDL);


        public const byte OP_RD_BELT   =   0x30;


        /*
        #define     WR_CFG_DEVI           0x12
        #define     WR_CFG_ELSY           0x13
        #define     WR_CFG_ELEM           0x14
        #define     WR_CFG_ELDT           0x15
        #define     WR_CFG_COM1           0x16
        #define     WR_CFG_COM2           0x17
        #define     WR_CFG_COM3           0x18
        #define     WR_CFG_COM4           0x19*/
        //

        /*
        #define     RD_CFG_DEVI           0x22
        #define     RD_CFG_ELSY           0x23
        #define     RD_CFG_ELEM           0x24
        #define     RD_CFG_ELDT           0x25
        #define     RD_CFG_COM1           0x26
        #define     RD_CFG_COM2           0x27
        #define     RD_CFG_COM3           0x28
        #define     RD_CFG_COM4           0x29
        */
        
        //RD VALUE

        /*
        #define     RD_BELT_ELSY          0x31
        #define     RD_BELT_ELEM          0x32
        #define     RD_BELT_ELDT          0x33
        */
        
        //SET_DT
        public const byte SET   =                   0x40;
            public const byte SET_DT_FORCE  =       0x40;      //强制设置
            public const byte SET_DT_NOTIFY =       0x41;      //通知，TERM决定是否更新
            public const byte SET_DEFAULT   =       0x42;      //initial

            public const byte WR_INST       =       0x50;      //测试发送,按proj0
        //#define     WR_INST1              0x51      //测试发送,按proj1
        //#define     WR_INST2              0x52      //测试发送,按proj2
        //#define     WR_INST3              0x53      //测试发送,按proj3






        /*
        // For index file-name: real.index
        //public const String[] op_type = {"null", "real", "log", "status", "inst", "sign", "heart", "kick", "low"};
    
        //已趋向业务末端, 可针对业务:
        public const byte WR_FILE               = 0x10;
        public const byte RD_FILE               = 0x20;
    
        public const byte WR_CFG               = 0x10;
        public const byte WR_MDL               = 0x11;
    
        public const byte WR_CFG_DEVI          = 0x11;
        public const byte WR_CFG_ELSY          = 0x12;
        public const byte WR_CFG_ELEM          = 0x13;
        public const byte WR_CFG_ELDT          = 0x14;
        public const byte WR_CFG_COM1          = 0x15;
        public const byte WR_CFG_COM2          = 0x16;
        public const byte WR_CFG_COM3          = 0x17;
        public const byte WR_CFG_COM4          = 0x18;
        //
    
        public const byte RD_CFG               = 0x20;
        public const byte RD_MDL               = 0x21;
    
        public const byte RD_CFG_DEVI          = 0x21;
        public const byte RD_CFG_ELSY          = 0x22;
        public const byte RD_CFG_ELEM          = 0x23;
        public const byte RD_CFG_ELDT          = 0x24;
        public const byte RD_CFG_COM1          = 0x25;
        public const byte RD_CFG_COM2          = 0x26;
        public const byte RD_CFG_COM3          = 0x27;
        public const byte RD_CFG_COM4          = 0x28;
       

        //RD VALUE
        public const byte RD_BELT              = 0x30;
        
        public const byte RD_BELT_ELSY         = 0x31;
        public const byte RD_BELT_ELEM         = 0x32;
        public const byte RD_BELT_ELDT         = 0x33;
    
        //其他
        //public const byte WAKE_R               = 0x40;       //用于 "A > R" 会话
        public const byte SET_DT_FORCE           = 0x40;
        public const byte SET_DT_NOTIFY          = 0x41;
        */

    
        //OP 不应针对业务
        /*
        public const byte MSG_NULL           = 0;
        public const byte MSG_REAL           = 1;
        public const byte MSG_LOG            = 2;
        public const byte MSG_STATUS         = 3;
        //
        public const byte INST               = 4;
        //sBody格式：action:RD|ADD|SET|DEL, 
        //          sDest:SETTINGS|TERMS|CLIENTS|TRELATIONS|CRELATIONS
    
        //Client ops.
        public const byte SYS_SIGN_IN         = 5;   //0x10; 
        public const byte SYS_HEARTBEAT       = 6;   //0x11;  
        //public const byte SYS_ACK           = 0x12;
    
        public const byte INST_BE_KICKED_OUT  = 7;     //kicked out by upstream, close this stream in.
        public const byte INST_LOW            = 8;     //inst-low-layer
        */

    }
}
